﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace SimpleSocxs.manage
{
    public partial class assets : AuthorizedPage
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void OnUploadAsset(object sender, EventArgs args)
        {
            if (!fuAsset.HasFile)
                return;
            SocxsDataStore.Current.UploadAsset(SocxsUser.ID, fuAsset);            
        }

        protected void OnDeleteAsset(object sender, EventArgs args)
        {
            var assetName = ((LinkButton)sender).CommandArgument;
            SocxsDataStore.Current.DeleteAsset(SocxsUser.ID, assetName);
        }

        protected void Page_PreRender(object sender, EventArgs args)
        {
            rpt.DataSource = SocxsDataStore.Current.GetAssets(SocxsUser.ID);
            DataBind();
        }
    }
}